<div class="top-list-page main">
  <div class="query-info shadowbox">
    <div class="container-header">红黑榜</div>
    <form class="base-info pa-form-content"
      name="queryForm" novalidate>
      <div class="pa-form-control pa-form-control-inline">
        <label class="name">施工队：</label>
        <select style="width: 240px;" 
          ng-model="topList.queryData.constructionTeamId">
          <option value=""></option>
          <optgroup ng-repeat="teamGroup in topList.teamWithOrgList"
              label="{{teamGroup.orgUnitName}}">
            <option ng-repeat="team in teamGroup.teamList"
              value="{{team.teamId}}">{{team.teamName}}</option>
          </optgroup>
        </select>
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label class="name">榜单类型：</label>
        <select ng-model="topList.queryData.rbType">
          <option value=""></option>
          <option value="1">红榜</option>
          <option value="0">黑榜</option>
        </select>
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label class="name">状态：</label>
        <select ng-model="topList.queryData.temporaryState">
          <option value=""></option>
          <option value="0">未审批</option>
          <option value="1">审批通过</option>
          <option value="2">审批未通过</option>
        </select>
      </div>
      <div class="pa-form-control pa-form-control-inline">
        <label class="name">时间：</label>
        <input type="text" class="form-control-input" name="startTime" 
          ng-datepicker  ng-model="topList.queryData.startTime"/>
        到
        <input type="text" class="form-control-input" name="endTime" 
          ng-datepicker  ng-model="topList.queryData.endTime"/>
      </div>
    </form>
    <div class="btn-outer-right">
      <a class="pa-btn" ng-click="topList.query(queryForm)"> <i class="fa fa-search"></i>
        <span class="ml5">查询</span>
      </a>
      <a class="pa-btn reset-btn" ng-click="topList.reset()"> <i class="fa fa-repeat"></i>
        <span class="ml5">重置</span>
      </a>
    </div>
  </div>
  <div class="pa-table-container shadowbox">
    <div class="list-title">
      <div class="add-content-btn"
        authorization-btn="api/redBlack/redBlackList/insert"
        ng-click="$state.go('topListAddition')">
        <img class="add-img-btn"
          src="../../../assets/images/add-item-tech.png">
        <span>新增红黑榜记录</span>
      </div>
    </div>
    <div class="list-detail">
      <form class="base-info">
        <table class="pa-table">
          <thead>
            <tr>
              <th>标段</th>
              <th>施工队</th>
              <th>榜单类型</th>
              <th>状态</th>
              <th>上榜时间</th>
              <th>简介</th>
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
            <tr ng-repeat="item in topList.topList track by $index">
              <td>{{item.name}}</td>
              <td>{{item.constructionTeamName}}</td>
              <td>
                {{item.rbType == 0 ? '黑榜' : 
              item.rbType == 1 ? '红榜' : ''}}
              </td>
              <td
                ng-class="{'nostart':item.temporaryState == '0',
                            'has-complete':item.temporaryState == '1',
                            'ongoing':item.temporaryState == '2'}">
                {{item.temporaryState == 0 ? '未审批' : 
              item.temporaryState == 1 ? '审批通过' :
              item.temporaryState == 2 ? '审批未通过' : ''}}
              </td>
              <td>{{item.checkDate1}}</td>
              <td>{{item.reason}}</td>
              <td>
                <div class="del"
                  authorization-btn="api/redBlack/redBlackList/select"
                  ng-click="$state.go('topListDetail', {type: 'detail', id: item.id})">
                  <i class="fa fa-street-view color"></i>
                  <span class="list-detail">查看</span>
                </div>
                <div class="del"
                  ng-show="item.temporaryState == 0" 
                  authorization-btn="api/redBlack/redBlackCheckRecord/insert"
                  ng-click="$state.go('topListDetail', {type: 'check', id: item.id})">
                  <i class="fa fa-pencil color"></i>
                  <span class="list-detail">审批</span>
                </div>
                <div class="del"
                  authorization-btn="api/redBlack/redBlackList/delete"
                  ng-click="topList.delete(item.id)">
                  <i class="fa fa-trash color"></i>
                  <span class="list-detail">删除</span>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
      </form>
    </div>
    <div class="total-num">
      共计
      <span class="total-num-colorful">{{topList.paginationData.total}}</span>
      条
    </div>
    <!-- 分页 -->
    <div class="pagination-outer">
      <uib-pagination
        total-items="topList.paginationData.total"
        ng-model="topList.paginationData.pageNum"
        items-per-page="topList.paginationData.pageSize"
        ng-change="pageChange()"
        class="pagination-sm"
        boundary-link-numbers="true"
        max-size="5"
        next-text="下一页"
        previous-text="上一页"></uib-pagination>
    </div>
  </div>
</div>